<?php
/**
 * Created by PhpStorm.
 * User: dumbledore
 * Date: 2018/8/20
 * Time: 上午9:22
 */
error_reporting(0);
define('IN_QY',true);
session_start();
require("include/common.inc.php");
require("sku_model.php");
define('SCRIPT','ad_list');
if(!$_COOKIE['userid']){
    echo "<script type='text/javascript'>location.href='/wap/mlogin.php';</script>";
    exit;
}
$order_id = $_GET['oid'];
$sql = "select sum(expresstri) as totexp from tbl_taorder where orderid='" . $order_id . "'";
$yunfei=c_getRow($sql)['totexp']; // 运费

$rowtax = c_getRow("select * from tbl_taorder where orderid='" . $order_id . "' order by id desc limit 1");

$sqladd = "select * from tbl_fh where infoid='".$order_id."'";
$rowadd = c_getRow($sqladd); // 发货信息

$sql = "select sum(totprice+expresstri) as gtot from tbl_taorder where orderid='" . $order_id . "'";
$temgtot = c_getRow($sql)['gtot']; //总价





?>

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">

    <title>订单详情</title>
    <link type="text/css" href="/ui/layui/css/layui.css" rel="stylesheet" />
    <link href="fetch/AmazeUI-2.4.2/assets/css/amazeui.css" rel="stylesheet" type="text/css" />
    <link href="fetch/basic/css/demo.css" rel="stylesheet" type="text/css" />
    <link href="fetch/css/cartstyle.css" rel="stylesheet" type="text/css" />
    <link href="fetch/css/jsstyle.css" rel="stylesheet" type="text/css" />
    <script src="/sy/adz/js/jquery.min.js"></script>
    <script type="text/javascript" src="fetch/js/address.js"></script>
    <script src="/ui/layer/layer.js"></script>
    <script type="text/javascript" src="/ui/layui/layui.js"></script>

    <style>
        #searchnav{height: 20px; text-align: center;margin-left: 18px;}
        #searchnav p{height: 100%; width: 48px; margin-right: 6px; border-radius:10px 10px 0 0; float: left; cursor: pointer; color: #fff; background: linear-gradient(#f86b54,#dc4835);}
        .city{
            margin-right: 40px;
        }
    </style>
</head>

<!--顶部导航条 -->
<?include('head.php');?>

<div class="concent">
    <!--地址 -->
    <div class="paycont">
        <div class="address">
            <h3>收货地址 </h3>
            <div class="clear"></div>
            <ul>
                <div class="per-border"></div>

                    <li class="user-addresslist defaultAddr ">

                        <div class="address-left">
                            <div class="user DefaultAddr">

										<span class="buy-address-detail">
	                   						<span class="buy-user"><?php echo $rowadd['name']; ?></span>
											<span class="buy-phone"><?php echo $rowadd['telnum']; ?></span>
										</span>
                            </div>
                            <div class="default-address DefaultAddr">
                                <span class="buy-line-title buy-line-title-type">收货地址：</span>
                                <span class="buy--address-detail">
								   		<?php echo $rowadd['diqu']; ?> <?php echo $rowadd['address']; ?>
								</span>
                            </div>
                        </div>
                        <div class="address-right">
                            <span class="am-icon-angle-right am-icon-lg"></span>
                        </div>
                        <div class="clear"></div>
                    </li>
            </ul>

            <div class="clear"></div>
        </div>

        <!--订单 -->
        <!--订单 -->
        <div class="concent">
            <div id="payTable">
                <h3>确认订单信息</h3>
                <div class="cart-table-th">
                    <div class="wp">

                        <div class="th th-item">
                            <div class="td-inner">商品信息</div>
                        </div>
                        <div class="th th-price">
                            <div class="td-inner">单价</div>
                        </div>
                        <div class="th th-amount">
                            <div class="td-inner">数量</div>
                        </div>
                        <div class="th th-sum">
                            <div class="td-inner">金额</div>
                        </div>
                        <!-- <div class="th th-oplist">
                          <div class="td-inner">配送费</div>
                        </div> -->

                    </div>
                </div>
                <div class="clear"></div>
                <?php
                $sql = "select t1.*,t2.chtitle,t2.img,t2.unit from tbl_taorder t1 inner join tbl_taospp t2 on t1.goodid=t2.id where t1.orderid='" . $order_id . "'";
                $querytao = mysql_query($sql);
                while ($row = mysql_fetch_array($querytao)) {
                    $temp = $row['img'];
                    $imgarr = explode(",", $temp);
                    ?>
                    <tr class="item-list">
                        <div class="bundle  bundle-last">

                            <div class="bundle-main">
                                <ul class="item-content clearfix">
                                    <div class="pay-phone">
                                        <li class="td td-item">
                                            <div class="item-pic">
                                                <a href="taogoodetail.php?id=<?php echo $row['goodid']; ?>"
                                                   class="J_MakePoint">
                                                    <img src="<?php echo $imgarr[0]; ?>" width="80" height="80"
                                                         class="itempic J_ItemImg"></a>
                                            </div>
                                            <div class="item-info">
                                                <div class="item-basic-info">
                                                    <a href="taogoodetail.php?id=<?php echo $row['goodid']; ?>"
                                                       class="item-title J_MakePoint"
                                                       data-point="tbcart.8.11"><?php echo $row['chtitle']; ?></a>
                                                </div>
                                            </div>
                                        </li>
                                        <li class="td td-info">
                                            <div class="item-props">
                            <span class="sku-line">
                                <?php
                                if($row['sku_id']){
                                    list($r1, $r2, $sku_price, $sku_store, $r3) = get_sku_info_by_id($row['sku_id']);
                                    foreach ($r3 as $sk){
                                        $sku_key_name = $sk['sku_key_name'];
                                        $sku_value_name = $sk['sku_value_name'];
                                        echo '<span>'.$sku_key_name.'：'.$sku_value_name.'</span><br>';
                                    }
                                }
                                ?>
                            </span>
                                            </div>
                                        </li>
                                        <li class="td td-price">
                                            <div class="item-price price-promo-promo">
                                                <div class="price-content">
                                                    <em class="J_Price price-now"><?php echo floatval($row['gprice']); ?></em>
                                                </div>
                                            </div>
                                        </li>
                                    </div>
                                    <li class="td td-amount">
                                        <div class="amount-wrapper ">
                                            <div class="item-amount ">
                                                <span class="phone-title">购买数量</span>
                                                <div class="sl">
                                                    <em class="J_Price price-now"><?php echo $row['gnum']; ?></em>
                                                </div>
                                            </div>
                                        </div>
                                    </li>
                                    <li class="td td-sum">
                                        <div class="td-inner">
                                            <em tabindex="0"
                                                class="J_ItemSum number"><?php echo floatval($row['totprice']); ?></em>
                                        </div>
                                    </li>
                                    <!--  <li class="td td-oplist">
                        <div class="td-inner">
                          <span class="phone-title">配送费</span>
                          <div class="pay-logis">
                            <b class="sys_item_freprice"><?php echo floatval($row['expresstri']); ?></b>元
                          </div>
                        </div>
                      </li> -->

                                </ul>
                                <div class="clear"></div>

                            </div>
                    </tr>
                <?php } ?>
                <div class="clear"></div>
            </div>

        </div>
        <!--订单结束 -->
        <div class="buy-point-discharge ">
            <input type="hidden" >
            <p class="price g_price ">
                运费 <span>¥</span><em class="pay-sum" id=""><?=$yunfei?></em>
            </p>
        </div>
        <div class="buy-point-discharge ">
            <input type="hidden" >
            <p class="price g_price ">
                优惠 <span>¥</span><em class="pay-sum" id=""><?=$rowtax['yhqmoney']?$rowtax['yhqmoney']:0 ?></em>
            </p>
        </div>
        <div class="buy-point-discharge ">
            <p class="price g_price ">
                合计（含运费）<span>¥</span><em class="pay-sum" id=""><?=$temgtot ?></em>
            </p>
        </div>
        <?php if ($rowtax['is_tax'] == 1) { ?>
        <div class="buy-point-discharge " id="" >
            <p class="price g_price ">
                税费 <span>¥</span><em class="pay-sum" ><?php echo $rowtax['taxpri']; ?></em>
            </p>
        </div>
        <? } ?>
        <?php if ($rowtax['taxman']) { ?>
            <div class="buy-point-discharge " id="" >
                <p class="price g_price ">
                    纳税人 <span>：</span><em class="" ><?php echo $rowtax['taxman']; ?></em>
                </p>
            </div>
        <? } ?>
        <?php if ($rowtax['taxconfig']) { ?>
            <div class="buy-point-discharge " id="" >
                <p class="price g_price ">
                    纳税识别号 <span>：</span><em class="" ><?php echo $rowtax['taxconfig']; ?></em>
                </p>
            </div>
        <? } ?>
        <div class="buy-point-discharge ">
            <p class="price g_price ">
                实付款 <span>¥</span><em class="pay-sum" id=""><?php echo $temgtot + $rowtax['taxpri'] - $rowtax['yhqmoney']; ?></em>
            </p>
        </div>
    </div>

    <div class="clear"></div>
</div>
<?include('footerr.php');?>
<script>
    //弹出一个页面层
    $('#contseller').on('click', function(){
        //
        layer.open({
            type: 2,
            title: '联系卖家',
            shadeClose: true,
            shade: 0.8,
            area: ['500px', '700px'],
            content: '/vip/liaoliao.php?fid=<?=$rowlbb['daili']?>' //iframe的url
        });
//
    });
</script>

</body>
</html>
